const express = require('express');

const app = express();

// 先匹配的是common middleWare
app.use((req, res, next) => {
    console.log('common middleWare');
    res.end('hello');
})

// 路径匹配中间件
app.use('/home', (req, res, next) => {
    console.log('home middleWare 01');
    // res.end('Home Middleware')
    // 如果不调用next,执行过程就会终止  
    next();
})

app.use('/home', (req, res, next) => {
    console.log('home middleWare 02');
    res.end('Home Middleware')
})

app.listen(8000, () => {
    console.log('express服务器启动成功');
})